﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Forum.Entity.Member;
using Forum.DAL.Member;
using Frame.Lib.Core.Base;

namespace Forum.BLL.Member
{
    public class MemberBaseBO : CommonOperate<MemberBaseInfo>
    {
        private MemberBaseDAL _memberBase;
        protected override BaseDAL DAL
        {
            get
            {
                return _memberBase;

            }
        }
        public MemberBaseBO()
        {
            _memberBase = new MemberBaseDAL();
        }

        
        public List<MemberBaseInfo> GetList(List<string> loginNames, out string notExistNames)
        {
            List<MemberBaseInfo> list = _memberBase.GetList(loginNames);

            notExistNames = "";

            IEnumerable<string> names = list.Select(T => T.LoginName);
            foreach (string name in loginNames)
            {
                if (!names.Contains(name))
                {
                    notExistNames += "," + name;
                }
            }

            notExistNames = notExistNames.Trim(',');

            return list;
        }

        public List<MemberBaseInfo> GetList(List<int> memberIDs)
        {
            List<MemberBaseInfo> list = _memberBase.GetList(memberIDs);
            return list;
        }


        public MemberBaseInfo GetInfoByLoginName(string loginName)
        {
            MemberBaseInfo info = _memberBase.GetInfoByLoginName(loginName);
            return info;
        }
    }
}
